import React, { Component } from 'react';
import { View, StyleSheet, Text, Image } from 'react-native';
import { Flex, Toast, TextareaItem, WingBlank, Button } from '@ant-design/react-native';
import {setApplyState} from '~/api/bank';

export default class Feedback extends Component {
    static navigationOptions = {
        title: '意见反馈',
    };
    constructor(props) {
        super(props);
        this.state = {
            text: '',
            state: this.props.navigation.getParam('state'),
            ParkingOrderID: this.props.navigation.getParam('ParkingOrderID')
        };
    }
    onPress = () => {
        setApplyState({
            id: this.state.ParkingOrderID,
            state: this.state.state,
            content: this.state.text,
        }).then((r) => {
            if (r.code === 0) {
                Toast.info('成功');
                this.props.navigation.push('myLoan')
            } else {
                Toast.info(r.msg);
            }
        });
    }
    render() {
        const setFeedback = (text) => {
            this.setState({
                text: text,
            });
        };
        return (
            <WingBlank size='lg'>
                <View style={{ width: '100%', height: 200, flexDirection: 'column', marginTop: 20 }}>
                    <TextareaItem placeholder='请输入审核失败原因' rows={4} onChange={setFeedback}></TextareaItem>
                    <Button type='warning' style={{ marginTop: '100%' }} onPress={() => {this.onPress()}}>提交</Button>
                </View>
            </WingBlank>
        )
    }
}
